package com.starbucks.opencase.tool;

import com.starbucks.opencase.entity.entUserFriend;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class toolUserFriend {
    @Autowired
    private JdbcTemplate con;

    /**
     * 获取好友列表
     * @param uid
     * @return
     */
    public List<entUserFriend> queryList(String uid){
        return con.query("select * from user_friend where uid=?",new BeanPropertyRowMapper<>(entUserFriend.class),uid);
    }
    public boolean add(String uid,String fuid){
        return con.update("insert into user_friend values(?,?,?)",uid,fuid,System.currentTimeMillis())>0;
    }
}
